﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<title>WindowsDebugger</title>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css"> 
<!-- 
.selected {font-weight: normal;background-color: #E2E2E2;padding:0px,2px,0px,2px;}
.unselected { font-weight: normal;padding:0px,2px,0px,2px;}
.hand { cursor: hand; }
.p {height: 16px;width: 16px;vertical-align: middle;border: 0;}
div,body { font-family: Tahoma, Verdana; font-size: 11px; }
A:link {text-decoration: none; color:#000000}
A:visited {text-decoration: none; color: #000000}
A:active {text-decoration: none; color: #000000 }
A:hover {text-decoration: none; color: #FF0000 }

-->
</style>

<script>

var words = new Array();
var rank = new Array();

function highlight(key) {
var i;
var body = parent.content.document.body.innerHTML;

for(i=0;i<words.length;i++){
	var reg = new RegExp("(>[^<>]*)(" + words[i] + ")+([^<>]*<)","gi");
	body = body.replace(reg, "$1<span style=\"color:white; background-color: Red;\">$2</span>$3");
}

parent.content.document.body.innerHTML = body;
}

function highlightWhenComplete(){
	if(navigator.userAgent.indexOf("Firefox")>-1){
		if(parent.contentLoaded){
			highlight(words.join('|'));
			return;
		}
	}else{
		if(parent.content.document.readyState){
			if(parent.content.document.readyState == 'complete'){
				highlight(words.join('|'));
				return;
			}
		}else{
			if(parent.contentLoaded){
				highlight(words.join('|'));
				return;
			}
		}
	}
	window.setTimeout("highlightWhenComplete();",200);
}

function Go(){
	var i;
	var url = "";
	for(i=0;i<document.getElementById("Result").options.length;i++){
		 if(document.getElementById("Result").options[i].selected){
			url = document.getElementById("Result").options[i].value;
			break;
		 }
	}
	if(url!=""){
		parent.contentLoaded = false;
		parent.content.location = url;
		window.setTimeout("highlightWhenComplete();",200);
	}
}

function window_resize(){
if(navigator.userAgent.indexOf("iPad")>-1||navigator.userAgent.indexOf("iPhone")>-1||navigator.userAgent.indexOf("iPod")>-1||navigator.userAgent.indexOf("Android")>-1){
document.getElementById("Result").style.cssText = "height: auto;width: " + (window.innerWidth-20);
document.getElementById("keyword").style.cssText = "width: " + (window.innerWidth-20);
}else if(window.innerHeight){
document.getElementById("Result").style.cssText = "height: " + (window.innerHeight- 135) + "; width: " + (window.innerWidth-20);
document.getElementById("keyword").style.cssText = "width: " + (window.innerWidth-20);
}else{
document.getElementById("Result").style.cssText = "height: " + (document.body.offsetHeight - 130) + "; width: " + (document.body.offsetWidth - 20);
document.getElementById("keyword").style.cssText = "width: " + (document.body.offsetWidth - 20);
}
}

function SearchIt(){

	function addToRanks(index,r){
		var i;
		var n = 0;
		for(i=0;i<rank.length;i++){
			if(rank[i][0]==index){
				rank[i][1] += r;
				return;
			}
		}
		n = rank.length;
		rank[n] = new Array();
		rank[n][0]=index;
		rank[n][1]=r;
	}

var i,j;
var tn,str;

var forSearch = new Array();
str = document.getElementById("keyword").value;


var inquote = false;
var tmp = "";
words.length = 0;

for(i=0;i<str.length;i++){
	if(inquote){
		if(str.charAt(i)=='"'){
			if(tmp!="") {words[words.length]=tmp; tmp="";}
			inquote = false;
		}else{
			tmp += str.charAt(i);
		}
	}else{
		if(str.charAt(i)=='"'){
			if(tmp!="") {words[words.length]=tmp; tmp="";}
			inquote = true;
		}else if(str.charAt(i)==' '){
			if(tmp!="") {words[words.length]=tmp; tmp="";}
		}else{
			tmp += str.charAt(i);
		}
	}
}
if(tmp!="") {words[words.length]=tmp; tmp="";}


document.getElementById("Result").options.length = 0;

var rrank = 1;
var RegExp_words = new Array();



for(i=0;i<words.length;i++){
	RegExp_words[i] = new RegExp(words[i], "gi");
}

forSearch.length=0; 
if(!document.getElementById("previousResult").checked){
	tn = contents.length / 3;
	for(i=0;i<=tn - 1;i++){
		forSearch[i] = i;
	}
}else{
	for(i=0;i<rank.length;i++){
		forSearch[i] = rank[i][0];
	}
}
rank.length = 0;

for(i=0;i<=forSearch.length - 1;i++){
	str = contents[forSearch[i]*3 + 1];
	rrank=1;
	for(j=0;j<RegExp_words.length;j++){
		r = str.match(RegExp_words[j]);
		if(r != null){
			rrank *= (r.length + 1);
		}
	}
	if(rrank>1){
		addToRanks(forSearch[i], Math.round(Math.pow(rrank,1/RegExp_words.length) * 20));
	}
}

if(!document.getElementById("titleOnly").checked){
	for(i=0;i<=forSearch.length - 1;i++){
		str = contents[forSearch[i]*3];
		rrank=1;
		for(j=0;j<RegExp_words.length;j++){
			r = str.match(RegExp_words[j]);
			if(r != null){
				rrank *= (r.length + 1);
			}
		}
		if(rrank>1){
			addToRanks(forSearch[i], Math.round(Math.pow(rrank,1/RegExp_words.length)));
		}
	}
}
				
if(rank.length>0){
	var t= new Array();
	for(i=0;i<=rank.length-2;i++){
		for(j=0;j<=rank.length-2 -i;j++){
			if(rank[j][1]<rank[j+1][1]){
				t = rank[j];
				rank[j] = rank[j+1];
				rank[j+1] = t;
			}
		}
	}

	for(i=0;i<=rank.length-1;i++){
		document.getElementById("Result").options[document.getElementById("Result").options.length] = new Option(contents[rank[i][0]*3+1] + " [Rank:" + rank[i][1] + "]",contents[rank[i][0]*3+2].replace(/\\/g,'/') );
		if(i==0){
			document.getElementById("Result").selectedIndex = 0;
		}
	}

}else{
	alert(strings["No topics found!"]);

}

}

</script>
<script language="JavaScript" src="languages.js"></script>
<link href="style.css" rel="stylesheet" type="text/css">

</head>

<body bgcolor="#DCDBD6" leftmargin="5" topmargin="5" marginwidth="5" marginheight="5" onload="document.getElementById('loading').style.display='none';window_resize();document.getElementById('keyword').focus();" onresize="window_resize();">
<div id="loading"><font color="#FF0000" size="1"> <script>document.write(strings["Loading the data for search..."]);</script> 
</font><br><br></div>
<script language="JavaScript" src="data.js"></script>
<form name="form1" method="post" action="" onSubmit="SearchIt(); return false;">
  <table width="100%" border="0">
    <tr> 
      <td><span class="label"><script>document.write(strings["Type in the word(s) to search for:"]);</script></span><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><br>
        </font> <input name="keyword" type="text" class="label" id="keyword"></td>
    </tr>
    <tr>
      <td>
        <input type="checkbox" id="titleOnly">
        <label for="titleOnly" class="label"><script>document.write(strings["Search title only"]);</script></label> 
        <br> <input type="checkbox" id="previousResult"> 
        <label for="previousResult" class="label"><script>document.write(strings["Search previous results"]);</script></label></td>
    </tr>
    <tr> 
      <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td align="left"><script>document.write('<input type="submit" name="button" value="' + strings["Search"] + '" class="label" onClick="SearchIt(); return false;">');</script></td>
            <td align="right"><script>document.write('<input name="display" type="button" id="display" value="' + strings["Display"] + '" class="label" onClick="Go(); return false;">');</script></td>
          </tr>
        </table></td>
    </tr>
    <tr> 
      <td><select name="Result" size="20" id="Result" class="label" ondblclick="Go();">
        </select></td>
    </tr>
  </table>

  </form>
</body>
</html>
